package com.blockmeta.bbs.businesslibrary.umeng;


import android.view.animation.Interpolator;

/**
 * Created by AirThor
 * Date 2018/5/7.
 */

public class SpringInterpolator implements Interpolator {
    /**
     * 弹性因数 数值越大回弹效果越不明显 默认值给5
     */
    private float factor=5f;
    public SpringInterpolator(){}

    public SpringInterpolator(float factor){
        this.factor=factor;
    }

    @Override
    public float getInterpolation(float input) {
        return  (float) (Math.pow(2, -10 * input) * Math.sin((input - factor / 4) * (2 * Math.PI) / factor) + 1);
    }
}
